﻿using Marmat.Template.WinForm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Marmat.FrameWork
{

    /// <summary>
    /// 针对单据工厂的扩展函数
    /// </summary>
    public static class DocumentCommandObjectConversionProviderExtension
    {
        /// <summary>
        /// 获取对象变更属性的字典。
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="provider"></param>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static Dictionary<string, object> ToDictionary<T>(this IDocumentCommandObjectConversionProvider provider, T entity) where T : class
        {
            return ObjectConversionFactory.Conversion(entity, provider.GetConversion());
        }
    }
}
